#include <iostream>
using namespace std;
int d[100001],v[100001],a[100001],p[100001];
int main()
{
    freopen("detect.in","r",stdin);
    freopen("detect.out","w",stdout);
    int T,n,m,L,V;
    cin>>T;
    for(int i=1;i<=T;i++)
    {
        cin>>n>>m>>L>>V;
        for(int j=1;j<=n;j++)
        {
            cin>>d[i]>>v[i]>>a[i];
        }
        for(int j=1;j<=m;j++)
        {
            cin>>p[i];
        }
        cout<<n/2+1;
    }
    return 0;
}
